package org.lds.hotkey.console.business.rule.converter;

import org.lds.hotkey.console.business.rule.entity.Rule;
import org.lds.hotkey.console.business.rule.model.request.RuleBaseDeleteRequest;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class RuleBaseDeleteRequestToEntityConverter implements Converter<RuleBaseDeleteRequest, Rule> {

    @Override
    public Rule convert(RuleBaseDeleteRequest source) {
        return Rule.builder()
                .id(source.getId())
                .appId(source.getAppId())
                .key(source.getKey())
                .prefix(source.getPrefix())
                .interval(source.getInterval())
                .threshold(source.getThreshold())
                .duration(source.getDuration())
                .desc(source.getDesc())
                .build();
    }

}


